package com.eascs.spider.huangye88.actor;

import java.util.HashMap;
import java.util.Map;

import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.eascs.spider.huangye88.manager.CrawlerGuangdongManager;
import com.eascs.spider.huangye88.util.NetUtil;


public class Huangye88Actor implements Runnable{
	private static Logger logger = LoggerFactory.getLogger(Huangye88Actor.class);
	private CloseableHttpClient client;
	private String url;
	static CrawlerGuangdongManager manager = CrawlerGuangdongManager.getInstance();
	
	Huangye88Actor(){
		
	}
	
	public Huangye88Actor(CloseableHttpClient client ,String url){
		this.client=client;
		this.url =url;
	}
	@Override
	public void run(){
		Map<String, String> header = new HashMap<>();
		header.put("Referer", "http://www.huangye88.com/search.html?kw=深圳印刷&type=sale");
		HttpGet httpGet = NetUtil.initHttpGet(url, header, null);
		String html = NetUtil.extractPageRawText(NetUtil.execute(client, httpGet));
		if(html == null || "".equals(html))
			etl(html);
	}
	
	public static void etl(String html){
		try{
			Document document = Jsoup.parse(html);
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}